;(function(){

    // 搜索栏的定位
    class Fix{
        constructor(){
            this.bigBox = $(document);
            this.search = $(".search");
            this.listboxBtn = $(".search_none_box");
            this.listbox = $(".search_list");

        }
        addEvent(){
            var that = this;
            this.bigBox.scroll(function(){
                if(that.bigBox.scrollTop()>=490){
                    that.searchFix();
                    that.addHover();
                }
                if(that.bigBox.scrollTop()<=490){
                    that.searchNoFix();
                    that.addHover();
                }
            });
            
        }
        searchFix(){
            this.search.css({
                "position":"fixed",
                "top":0,
                "left":"50%",
                "transform":"translateX(-50%)",
                "padding-top":0,
            });
            this.listboxBtn.css({
                "display":"block"
            });
        }
        searchNoFix(){
            this.search.css({
                "position":"relative",
                "padding-top":"30px",
                "left":"0%",
                "transform":"translateX(0)",
            });
            this.listboxBtn.css({
                "display":"none"
            });
        }
        addHover(){
            var that = this;
            this.listboxBtn.hover(function(){
                that.listbox.css({
                    "display":"block",
                });
            },function(){
                that.listbox.css({
                    "display":"none",
                });
            });
        }


    }

    var fix = new Fix();
    fix.addEvent();

    class RightFix{
        constructor(){
            this.lastBox = $(".flxedbar_box_last");
        }
        goTop(){
            this.lastBox.click(function(){
                $(window).scrollTop(0);
            });
        }
    }

    var rightFix = new RightFix();
    rightFix.goTop();


}());